<?php

namespace common\validate;

use think\Validate;

class BaseValidate extends Validate
{
    public function __construct(array $rules = [], $message = [], $field = [])
    {
        parent::__construct($rules, $message, $field);
        self::setTypeMsg($this->currentTypeMsg);
    }

    protected $currentTypeMsg = [
        'require' => ':attribute 必传',
        'must' => ':attribute must',
        'number' => ':attribute 必须是数字',
        'integer' => ':attribute 必须是整数',
        'float' => ':attribute 必须是小数',
        'boolean' => ':attribute 必须是布尔值',
        'email' => ':attribute 不是一个合法的邮件地址',
        'mobile' => ':attribute 不是一个合法的手机号',
        'array' => ':attribute 必须是数组',
        'accepted' => ':attribute 必须是 yes,on 或 1',
        'date' => ':attribute not a valid datetime',
        'file' => ':attribute not a valid file',
        'image' => ':attribute not a valid image',
        'alpha' => ':attribute must be alpha',
        'alphaNum' => ':attribute must be alpha-numeric',
        'alphaDash' => ':attribute must be alpha-numeric, dash, underscore',
        'activeUrl' => ':attribute not a valid domain or ip',
        'chs' => ':attribute must be chinese',
        'chsAlpha' => ':attribute must be chinese or alpha',
        'chsAlphaNum' => ':attribute must be chinese,alpha-numeric',
        'chsDash' => ':attribute must be chinese,alpha-numeric,underscore, dash',
        'url' => ':attribute 不是一个URL',
        'ip' => ':attribute 不是一个IP',
        'dateFormat' => ':attribute must be dateFormat of :rule',
        'in' => ':attribute 只能为 :rule',
        'notIn' => ':attribute 不能为 :rule',
        'between' => ':attribute 必须在 :1 - :2 之间',
        'notBetween' => ':attribute 必须不在 :1 - :2 之间',
        'length' => ':attribute 的长度必须是 :rule',
        'max' => ':attribute 的最大长度是 :rule',
        'min' => ':attribute 的最小长度是 :rule',
        'after' => ':attribute cannot be less than :rule',
        'before' => ':attribute cannot exceed :rule',
        'expire' => ':attribute not within :rule',
        'allowIp' => 'access IP is not allowed',
        'denyIp' => 'access IP denied',
        'confirm' => ':attribute out of accord with :2',
        'different' => ':attribute cannot be same with :2',
        'egt' => ':attribute 必须大于等于 :rule',
        'gt' => ':attribute 必须大于 :rule',
        'elt' => ':attribute 必须小于等于 :rule',
        'lt' => ':attribute 必须小于 :rule',
        'eq' => ':attribute 必须等于 :rule',
        'unique' => ':attribute 已经存在',
        'regex' => ':attribute not conform to the rules',
        'method' => 'invalid Request method',
        'token' => 'invalid token',
        'fileSize' => 'filesize not match',
        'fileExt' => 'extensions to upload is not allowed',
        'fileMime' => 'mimetype to upload is not allowed',
    ];

}
